<script setup lang="ts">
import {onActivated, onDeactivated, onUnmounted, ref} from "vue";

let num = ref(0)

function changeNum() {
  num.value++
}
onUnmounted(()=>{
  console.log('销毁了')
})
onActivated(()=>{
  console.log('激活')
})
onDeactivated(()=>{
  console.log('未激活')
})
</script>

<template>
  <div>AAAA</div>
  {{ num }}
  <button @click="changeNum">num++</button>
</template>

<style scoped>

</style>
